//Check how many of exe with current name are running in your system


Public Function ChkExeExist(ByVal strName_exe As String) As Boolean
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
'               Check if exe exist in process list                           '
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
On Error GoTo err_hndl
Dim strSQL As String

    strSQL = "SELECT Name FROM Win32_Process WHERE Name='" & strName_exe & "'" 'Searching for the exe
    ChkExeExist = GetObject("winmgmts:").ExecQuery(strSQL).Count 'Return the count of how many exe with
                                                                'the current name are running in process list
Exit Function
err_hndl:
MsgBox "Error in ChkExeExist(): " & Err.Description, vbCritical
End Function
